<template>
  <div class="keyword">
    <el-form
      ref="formRef"
      :inline="true"
      :model="formModel"
      class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto"
    >
      <el-form-item>
        <el-input v-model="formModel.officer" placeholder="请输入" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" :icon="useRenderIcon('ri:search-line')">
          搜索
        </el-button>
        <el-button> 重置 </el-button>
      </el-form-item>
    </el-form>
    <PureTableBar :title="title">
      <template #buttons>
        <el-button type="primary" :icon="addIcon" :loading="loading">
          计划制定
        </el-button>
      </template>
      <pure-table
        ref="tableRef"
        border
        adaptive
        :adaptiveConfig="adaptiveConfig"
        row-key="id"
        alignWhole="center"
        showOverflowTooltip
        :loading="loading"
        :loading-config="loadingConfig"
        :data="
          dataList.slice(
            (pagination.currentPage - 1) * pagination.pageSize,
            pagination.currentPage * pagination.pageSize
          )
        "
        :columns="columns"
        :pagination="pagination"
        @page-size-change="onSizeChange"
        @page-current-change="onCurrentChange"
      >
        <template #operation>
          <el-button
            class="reset-margin"
            link
            type="primary"
            :size="size"
            :icon="editIcon"
          >
            编辑
          </el-button>
          <el-popconfirm :title="`是否删除`">
            <template #reference>
              <el-button
                class="reset-margin"
                link
                type="primary"
                :size="size"
                :icon="delIcon"
              >
                删除
              </el-button>
            </template>
          </el-popconfirm>
        </template>
      </pure-table>
    </PureTableBar>
  </div>
</template>

<script setup>
import { PureTableBar } from "@/components/RePureTableBar";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";

import { useKeyword } from "../hooks/useKeyword";
const {
  formModel,
  columns,
  addIcon,
  editIcon,
  delIcon,
  title,
  loading,
  dataList,
  pagination,
  loadingConfig,
  adaptiveConfig,
  onSizeChange,
  onCurrentChange,
  openDialog,
  handleDelete
} = useKeyword();
</script>

<style lang="scss" scoped>
.keyword {
}
</style>
